﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml;

namespace Centny
{
    public class PropertyRegister
    {
        private static Dictionary<Type, Dictionary<String, DependencyProperty>> Properties = new Dictionary<Type, Dictionary<string, DependencyProperty>>();
        public static DependencyProperty Register(string name, Type propertyType, Type ownerType, PropertyMetadata typeMetadata)
        {

            if (!Properties.ContainsKey(ownerType))
            {
                Properties[ownerType] = new Dictionary<string, DependencyProperty>();
            }
            DependencyProperty dp = DependencyProperty.Register(name, propertyType, ownerType, typeMetadata);
            Properties[ownerType][name] = dp;
            return dp;
        }
        public static Dictionary<String, DependencyProperty> TypeProperties(Type ownerType)
        {
            if (Properties.ContainsKey(ownerType))
            {
                return Properties[ownerType];
            }
            else
            {
                return null;
            }
        }
    }
}
